Ext.Loader.setConfig({enabled: true});
Ext.Loader.setPath('Ext.ux', './ux/');		
Ext.require([
		'Ext.tab.*',
		'Ext.panel.*',
		'Ext.fx.*',
		'Ext.toolbar.*',
		'Ext.button.*',
		'Ext.ux.BoxReorderer'
]);



Ext.onReady(function(){
	var tb = new Ext.Toolbar();
	tb.width = "100%";
	
	tb.add({
		text: '保存',
		margin: '0 5 0 5',
		handler: function(){
			var f = document.getElementById("AddJsydgh");
			f.submit();
		}
	});
	
	tb.add({
		text: '上传附件',
		margin: '0 5 0 5',
		handler: function(){
	
			var uploadForm = Ext.create('Ext.form.Panel', {
				width: "100%",
				border: 0,
				plain: true,
				bodyPadding: '10 10 0',
		
				defaults: {
					anchor: '100%',
					allowBlank: false,
					msgTarget: 'side',
					labelWidth: 80
				},
		
				items: [{
					xtype: 'textfield',
					fieldLabel: '文件名称',
					name: 'attactName'
				},{
					xtype: 'filefield',
					id: 'form-file',
					emptyText: '选择附件',
					fieldLabel: '选择附件',
					name: 'thumb',
					buttonText: '',
					buttonConfig: {
						iconCls: 'upload-icon'
					}
				}],
		
				buttons: [{
					text: '提交',
					handler: function(){
						var form = this.up('form').getForm();
						if(form.isValid()){
							form.submit({
								url: 'JsydghAddAttactment.action',
								waitMsg: '正在上传图片，请稍后...',
								success: function(fp, o) {
									Ext.Msg.alert('上传成功', '上传成功');
								},
								failure: function(){
									Ext.Msg.alert('上传成功', '上传成功');
								}
							});
						}
					}
				},{
					text: '重置',
					handler: function() {
						this.up('form').getForm().reset();
					}
				}]
			});
	
			var win = new Ext.Window({
				title: '上传附件',
				width: 500,
				
				items: [uploadForm],
			});
			
			win.show();
		}
	});
	
	// basic tabs 1, built from existing content
    var tabs = Ext.createWidget('tabpanel', {
        renderTo: 'tabs',
        activeTab: 0,
        width:  "100%",
        height: 3000,
        plain: true,
		style: 'background-color:#dfe8f6; ',
        defaults :{
            bodyPadding: 20
        },
		dockedItems:[{ 
				dock: 'top', 
				border: false,
				xtype: 'toolbar', 
				items:[tb]
		}],
        items: [{
			width:  "100%",
            contentEl:'script', 
            title: '建设用地规划申请书'
        }]
    });
});